package carmensd.vista.expedienteYvillanos

import org.uqbar.arena.widgets.Label
import org.uqbar.arena.widgets.List
import org.uqbar.arena.widgets.Panel
import org.uqbar.arena.widgets.TextBox
import modelo.Lugar
import org.uqbar.arena.bindings.PropertyAdapter

class AsistenteDeContenidos {

	static def colocarTextoSimple(Panel panel, String textoAColocar) {
		new Label(panel).setText(textoAColocar)
	}

	static def colocarTextBoxConValueBindeado(Panel panel, String propiedad) {
		new TextBox(panel).bindValueToProperty(propiedad)
	}

	static def colocarListaConItemsBindeados(Panel expedientePanel, String propiedad) {
		new List(expedientePanel) => [
			bindItemsToProperty(propiedad)
		]
	}

	static def colocarTextoConValueBindeado(Panel expedientePanel, String propiedad) {
		new Label(expedientePanel) => [
			width = 150
			bindValueToProperty(propiedad)
		]
	}
	
	def static crearLista(Panel contenedor, String destinoBinding, Class<?> tipoAMostrar, String visible) {
		new List(contenedor) => [
				allowNull(true)
				height = 90
				width = 150
				var binding = bindItemsToProperty(destinoBinding)
                binding.setAdapter(new PropertyAdapter(tipoAMostrar, visible))
			]
	}

}
